import { Table } from 'antd';

export default props => {
    const { data, cols, loading, page, total, onChange, attrs } = props;
    const { pageNo, pageSize } = (page || {});

    return <Table {...attrs} onChange={({ current: pageNo, pageSize }) => onChange({ ...page, pageNo, pageSize })} size="middle" bordered rowKey="id" columns={cols} dataSource={data} loading={loading} pagination={page ? {
        position: ['bottomLeft'],
        size: 'default',
        pageSize,
        showSizeChanger: true,
        current: pageNo,
        showQuickJumper: true,
        total,
        showTotal: total => `总共${total}条`
    } : false}></Table>
}